package gui;

import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import vars.Variables;

public class DayButton extends JButton implements Variables {

	private static final long serialVersionUID = 1730312005042920363L;
	private String id;
	private String toolTip;
	private boolean urlaubDay;

	public DayButton(String text, boolean enabled) {
		super(text);
		setEnabled(enabled);
		setPreferredSize(new Dimension(dayLength, dayHeight));
		setBorderPainted(true);
		setHorizontalTextPosition(SwingConstants.CENTER);
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public void removeToolTip()
	{
		setToolTipText(null);
	}
	
	@Override
	public void setToolTipText(String text) {
		super.setToolTipText(text);
		if (null != text)
			toolTip = text;
	}

	@Override
	public void setEnabled(boolean b) {
		super.setEnabled(b);
		super.setToolTipText(b ? toolTip : null);
	}

	public void setUrlaubDay(boolean urlaubDay) {
		this.urlaubDay = urlaubDay;
	}

	public boolean isUrlaubDay() {
		return urlaubDay;
	}
}
